/* 
    这是商品的相关ajax请求发送的接口调用层
*/
// 引入自己封装的request工具函数
import request from "@/utils/request"

export const getCategoryList = (params) => {
    return request({
        method: 'get',
        url: '/goods/catelist',
        params
    })
}

export const editCategory = (data) => {
    return request({
        method: 'post',
        url: '/goods/editcate',
        data
    })
}


// 获取商品列表
export const getGoodList = (params) => {
    return request({
        method: 'get',
        url: '/goods/list',
        params
    })
}


// 添加商品分类
export const addCate = (data) => {
    return request({
        method: 'post',
        url: '/goods/addcate',
        data
    })
}

// 删除商品分类
export const deleteCate = (id) => {
    return request({
        method: 'get',
        url: '/goods/delcate',
        params: {
            id
        }
    })
}


// 16.查询所有分类名称
export const queryCate = () => {
    return request({
        method: 'get',
        url: '/goods/categories',
    })
}


// 删除商品
export const deleteGood = (id) => {
    return request({
        method: 'get',
        url: '/goods/del',
        params: {
            id
        }
    })
}


// 修改商品
export const editGoods = (data) => {
    return request({
        method: 'post',
        url: '/goods/edit',
        data
    })
}

// 添加商品
export const addGoods = (data) => {
    return request({
        method: 'post',
        url: '/goods/add',
        data
    })
}
